<template>
  <div class="employeeContainer">
    <div class="employeeBar">
      <a-descriptions title="招聘中">
        <a-descriptions-item label="职位名称">
          {{ job.jobName }}
        </a-descriptions-item>
        <a-descriptions-item label="薪资">
          {{ job.jobSalary }}
        </a-descriptions-item>
        <a-descriptions-item label="工作地点">
          <i class="iconfont icon-location" />[{{ job.company.Area }}·{{ job.company.companyAddress }}]
        </a-descriptions-item>
      </a-descriptions>
    </div>
    <div class="employeeMain">
      <h2>职位描述</h2>
      <a-card style="width:100%;">
        <mavon-editor
          :value="job.jobDescribe"
          default-open="preview"
          :box-shadow="false"
          style="z-index:1;height:50vh"
          :editable="false"
          :subfield="false"
          :toolbars-flag="false"
        />
      </a-card>
      <h2>公司描述</h2>
      <a-card style="width:100%;">
        <mavon-editor
          :value="job.company.companyDescription"
          default-open="preview"
          :box-shadow="false"
          style="z-index:1;height:50vh"
          :editable="false"
          :subfield="false"
          :toolbars-flag="false"
        />
      </a-card>
      <el-button style="margin-top: 10px;" @click="dialogFormVisible = true">申请</el-button>
    </div>
    <el-dialog title="信息" :visible.sync="dialogFormVisible">
      <el-form :model="resumeForm">
        <el-form-item label="个人优势" :label-width="formLabelWidth">
          <el-input v-model="resumeForm.personAdvantage" autocomplete="off" />
        </el-form-item>
        <el-form-item label="期望工作" :label-width="formLabelWidth">
          <el-input v-model="resumeForm.wantJob" autocomplete="off" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="application">确 定</el-button>
      </div>
    </el-dialog>
  </div>

</template>

<script>
export default {
  name: 'EmployeeInfo',
  data() {
    return {
      job: '',
      jobId: '',
      dialogFormVisible: false,
      resumeForm: {
        userId: '',
        jobId: '',
        companyId: '',
        personAdvantage: '',
        wantJob: '',
        resumeState: ''
      },
      formLabelWidth: '120px'
    }
  },
  created() {
    // console.log(this.$route.params.jobId)
    const _this = this
    this.jobId = this.$route.params.jobId
    this.$http.get('/job/selectJobComByJobId/' + this.jobId).then(function(resp) {
      console.log(resp)
      _this.job = resp.data.data
    })
  },
  methods: {
    application: function() {
      this.resumeForm.userId = parseInt(this.$store.state.userId)
      this.resumeForm.jobId = this.jobId
      this.resumeForm.companyId = this.job.companyId
      this.resumeForm.resumeState = '0'
      this.$http.post('resume/insertOneResume', this.resumeForm).then(function(resp) {
        console.log(resp)
      })
      this.dialogFormVisible = true
      console.log(this.resumeForm)
    }
  }
}
</script>

<style scoped lang="scss">
  .employeeContainer{
    .employeeBar{
      margin-top: 20px;
      width: 1184px;
      height: 100px;
      background-color: white;
    }
    .employeeMain {
      margin-top: 20px;
    }
  }
</style>
